<?php 
##
#	Project: PHPDisk
#	This is NOT a freeware, use is subject to license terms.
#
#	Site: http://www.phpdisk.com
#
#	$Id: passport.php 4 2013-01-09 13:32:24Z along $
#
#	Copyright (C) 2008-2009 PHPDisk Team. All Rights Reserved.
#
##
include '../../includes/commons.inc.php';

//print_r($_POST);
$str = $_SERVER['QUERY_STRING'];
if($str){
	parse_str(base64_decode($str));
}else{
	exit('Error Param');
}
/*$username = trim(gpc('username','G',''));
$password = trim(gpc('password','G',''));
$sign = trim(gpc('sign','G',''));*/

if($sign!=strtoupper(md5($action.$username.$password))){
	exit('No data,Code:2!');
}
if($action=='passportlogin'){
	$rs = $db->fetch_one_array("select userid,gid,username,password,email from {$tpf}users where username='$username' and password='$password' limit 1");
	if($rs){
		pd_setcookie('phpdisk_info',pd_encode("{$rs[userid]}\t{$rs[gid]}\t{$rs[username]}\t{$rs[password]}\t{$rs[email]}"));
		header("Location: ".$settings[phpdisk_url].urr("mydisk",""));
	}else{
		exit('Passport Error!');
	}
}

exit;
?>
